<?=$userselection?>


<? // include('matches-teams.php');?>

<? include('matches-matchgroup.php');?>

<?php if ($isOwner): ?>
	<?=form_open('matches/insert', array('id' => 'matchForm'));?>
<?php endif; ?>

<table id="matches" border="0" cellpadding="2" cellspacing="2">

<thead><tr>
	<th id="matchgroup"> </th>
	<th><?=lang('match');?></th>
	<th colspan="2"><?=lang('result');?>/<?=lang('prediction');?></th>
	<th><?=lang('points');?></th>
</tr></thead>
	


<tbody>

<?php $summe=0; $i=0; foreach($matches as $match): ?>


<tr<?php if ($i++ % 2 == 0) echo ' class="odd"'; else echo ' class="even"'; ?>>

	<td class="right"><? printf(lang('matchgroup_type_short'), $match->matchgroup);?></td>
	<td class="match"><a href="<?=site_url('matches/match/'.$match->id)?>"><?=$match->team_h?> - <?=$match->team_a?></a></td>

<?php if ($match->isStarted): ?>
	<td class="right"><?=$match->goals_h?> : <?=$match->goals_a?></td>
	<td class="right"><?=$match->tipp_h?> : <?=$match->tipp_a?></td>
	<td><? $summe += getPoints($match->goals_h, $match->goals_a, $match->tipp_h, $match->tipp_a); ?></td>
<?php elseif ($isOwner): ?>
	<td class="center" colspan="2">
		<input class="hidden" name="id[]" type="hidden" value="<?=$match->id?>" />
		<input class="goals" name="tipp_h[]" type="text" value="<?=$match->tipp_h?>" maxlength="2" />
		<input class="goals" name="tipp_a[]" type="text" value="<?=$match->tipp_a?>" maxlength="2" />
	</td>
	<td class="date"><?=formatDate($match->deadline)?></td>
<?php else: ?>
	<td class="center" colspan="2">? : ?</td>
	<td class="date"><?=formatDate($match->deadline)?></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>

<tr class="pointssum">
	<td colspan="4"></td>
	<td class="right"><strong>&Sigma; = <?=$summe?></strong></td>
</tr>
	
</tbody></table>



<?php if ($isOwner): ?>
	<input type="hidden" name="redirect" value="<?=$redirect?>"/>
	<input class="submit" type="submit" value="<?=lang('predict');?>"/>
<?=form_close();?>
<?php endif; ?>

